<template>
    <div class="editor-tab" :class="{ active: currentTab == editorTab }" @click="$emit('changeTab',editorTab)">
        <span>{{ editorTab }}</span>
        <img class="editor-tab-img" src="../../assets/blue_close.png" alt="">
    </div>
</template>

<script setup>


//对于传递给子组件的props都是只读的，如果要修改需要emit向父组件通信
const props = defineProps(['editorTab', 'currentTab'])

</script>

<style scoped>


.editor-tab-img {
    height: 17px;
    width: 17px;
    margin-left: 10px;
}

.editor-tab {
    padding: 0 20px;
    display: flex;
    align-items: center;
    font-size: 13px;
    cursor: pointer;
    border-right: 1px solid #181a1f;
    position: relative;
    border-radius: 5px;
}

.editor-tab:hover {
    background: #4d78cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(77, 120, 204, 0.3);
}

.editor-tab.active {
    background-color: #087eece5;
}

.editor-tab.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #4d78cc;
}
</style>